cmake_minimum_required(VERSION 3.8)
project(terminal_service)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找libcurl库
find_package(CURL REQUIRED)

include_directories(../core)
include_directories(../core/common)
include_directories(../core/data)
include_directories(../core/db)
include_directories(../core/db/sqlite)
include_directories(../core/db/terminal)
include_directories(../core/logger)
include_directories(../core/protocols)
include_directories(../core/device)
include_directories(../core/services)
include_directories(../core/pub)
include_directories(../v1)

# 包含libcurl的头文件目录
include_directories(${CURL_INCLUDE_DIRS})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -L/usr/local/arm/openssl/lib64")

get_directory_property(out_var INCLUDE_DIRECTORIES)

add_executable(terminal_service 
    main.cpp
    config.cpp
    ../core/db/sqlite/sqlite3.c
    ../core/db/terminal/oiltrans.cpp
    ../core/db/terminal/sqlite/oiltrans_sqlite.cpp
    ../core/logger/logger.cpp
    ../core/data/configvalue.cpp
    ../core/common/cJSON.c
    ../core/common/configure.cpp
    ../core/common/httphelper.cpp
    ../core/common/md5.cpp
    ../core/common/resources.cpp
    ../core/common/json11.cpp
    ../core/protocols/protocol.cpp
    ../core/protocols/lora_protocol_v1.cpp
    ../core/protocols/net_protocol_v1.cpp
    ../core/data/sr2valhelper.cpp
    ../core/device/screenraw2valueby100.cpp
    ../core/device/screenraw2valueby130.cpp
    ../core/device/loradevice.cpp
    ../core/device/oiltanks.cpp
    ../core/device/serialport.cpp
    ../core/services/service.cpp
    ../core/services/loraservice.cpp
    ../v1/httphelper_v1.cpp
    ../core/pub/center.cpp
    ../core/pub/publisher.cpp
    ../core/pub/subscriber.cpp
)

target_link_libraries(terminal_service stdc++fs ${CURL_LIBRARIES} dl ssl crypto)